package com.fly.studio.home.app.concurrency;

import com.alibaba.fastjson.JSON;
import com.jd.platform.async.executor.Async;
import com.jd.platform.async.wrapper.WorkerWrapper;

import java.util.List;
import java.util.concurrent.ExecutionException;

/**
 * @author fuliying3
 * @date 2022/09/05 09:15:00
 */
public class AsyncToolTest {

    private static void testMulti7() throws ExecutionException, InterruptedException {
        ServerHelper serverHelper = new ServerHelper();
        List<Server> serverList = serverHelper.getServerList();
        System.out.println(JSON.toJSONString(serverHelper));

        WorkerWrapperHelper<String, String> workerWrapperHelper = new WorkerWrapperHelper<>();
        String param = "I'm a ";
        WorkerWrapper<String, String>[] workerWrappers = workerWrapperHelper.buildWorkerWrappers(serverList, param);

        Async.beginWork(3100, workerWrappers);
        Async.shutDown();
    }

    public static void main(String[] args) throws Exception {
        testMulti7();
    }
}
